package com.itheima.controller;

import com.github.pagehelper.Page;
import com.itheima.entity.PageResult;
import com.itheima.pojo.Comment;
import com.itheima.pojo.Feedback;
import com.itheima.service.FeedbackService;
import com.itheima.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("/feedback")
public class FeedbackController {

    @Autowired
    private FeedbackService feedbackService;

    //获取反馈列表
    @PostMapping("/getList")
    public Result getList(@RequestBody Map<String,Object> feedbackVO){
        PageResult<Feedback> feedbackPage = feedbackService.findAll(feedbackVO);
        return new Result("success",feedbackPage);
    }

    //编辑反馈
    @PostMapping("/edit")
    public Result edit(@RequestBody Map<String,Object> feedbackVO){
        feedbackService.edit(feedbackVO);
        return new Result("success","操作成功");
    }

    //批量删除反馈
    @PostMapping("/deleteBatch")
    public Result deleteBatch(@RequestBody List<Map<String,Object>> feedbackVOList){
        feedbackService.deleteBatch(feedbackVOList);
        return new Result("success","操作成功");
    }

}
